<!--
 * @Descripttion: 
 * @Author: voanit
 * @Date: 2022-08-27 18:14:17
 * @LastEditors: voanit
 * @LastEditTime: 2022-08-31 14:40:14
-->
<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>

<body>
  <script>
    // 目的：
    /* 
    [
      {
         goods_id: "111",
          goods_price: 118,
           goods_count: 1,
      },
      {
         goods_id: "222",
          goods_price: 222,
           goods_count: 1,
      }
    ]
    
    */
    var arr = [
      {
        goods_count: 1,
        goods_id: "111",
        goods_name: "朗龙(Rhone)净味炭膏 新车除甲醛汽车除味剂 车载空气净化 车内去异味 RC11K",
        goods_price: 118,
        goods_select: true,
        goods_small_logo: "http://image3.suning.cn/uimg/b2c/newcatentries/0070075424-000000000137468134_1_400x400.jpg",
      },
      {
        goods_count: 2,
        goods_id: "2222",
        goods_name: "2222朗龙(Rhone)净味炭膏 新车除甲醛汽车除味剂 车载空气净化 车内去异味 RC11K",
        goods_price: 222,
        goods_select: true,
        goods_small_logo: "http://image3.suning.cn/uimg/b2c/newcatentries/0070075424-000000000137468134_1_400x400.jpg",
      }
    ]

    var newArr = arr.map(item => {
      return {
        goods_id: item.goods_id,
        goods_price: item.goods_price,
        goods_count: item.goods_count,
      }
    })
    console.log(newArr, 88);


    // var arr = [1, 2, 3, 2]
    // var newArr2 = arr.map(item => {
    //   // return true
    //   if (item == 2) {
    //     return item
    //   }
    // })
    // var newArr2 = arr.some(item => {
    //   // return true
    //   if (item == 2) {
    //     return item
    //   }
    // })
    // console.log(newArr2, 77);
  </script>
</body>

</html>